package it.gtd.swimpool.controller.mapper;

import it.gtd.swimpool.controller.exception.ItemNotFoundException;

import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;

@Provider
public class ItemNotFoundExceptionMapper implements ExceptionMapper<ItemNotFoundException> {
    @Override
    public Response toResponse(ItemNotFoundException throwable) {
        return Response.status(Response.Status.NOT_FOUND).entity(throwable.getMessage()).build();
    }
}
